#include <iostream>
#include <algorithm>
using namespace std;

const int N = 5e4 + 10;

int n;
int a[N], b[N];

int main()
{
	cin >> n;

	for (int i = 1; i <= n; i++)	cin >> a[i];
	for (int i = 1; i <= n; i++)	cin >> b[i];

	sort(a + 1, a + 1+ n);
	sort(b + 1, b + 1+ n);

	int sum = 0;
	for (int i = 1; i <= n; i++)
	{
		sum += abs(b[i] - a[i]);
	}

	cout << sum << endl;

	return 0;
}